//package com.eastfair.cloud.seata;
//
//import com.eastfair.core.context.ContextUtil;
//import io.seata.tm.api.DefaultFailureHandlerImpl;
//import io.seata.tm.api.GlobalTransaction;
//import lombok.extern.slf4j.Slf4j;
//import org.springframework.stereotype.Component;
//
///**
// * Seata 分布式事物失败的提示
// *SeataAutoConfiguration
// * @author huan.fu 2021/10/8 - 下午1:51
// */
////@Component("SeataFailureHandler")
//@Slf4j
//public class SeataFailureHandler extends DefaultFailureHandlerImpl {
//    @Override
//    public void onBeginFailure(GlobalTransaction tx, Throwable cause) {
//        super.onBeginFailure(tx, cause);
//        log.info("邮件告诉:分布式事物出现异常:[onBeginFailure],xid:[{}]", tx.getXid());
//        log.debug("SeataTransactionError:{}|{}|{}", ContextUtil.getTrace(), tx.getXid(), cause.fillInStackTrace().getMessage());
//
//    }
//
//    @Override
//    public void onCommitFailure(GlobalTransaction tx, Throwable cause) {
//        super.onCommitFailure(tx, cause);
//        log.info("邮件告诉:分布式事物出现异常:[onCommitFailure],xid:[{}]", tx.getXid());
//
//        log.debug("SeataTransactionError:{}|{}|{}", ContextUtil.getTrace(), tx.getXid(), cause.fillInStackTrace().getMessage());
//
//    }
//
//    @Override
//    public void onRollbackFailure(GlobalTransaction tx, Throwable originalException) {
//        super.onRollbackFailure(tx, originalException);
//        log.info("邮件告诉:分布式事物出现异常:[onRollbackFailure],xid:[{}]", tx.getXid());
//        log.debug("SeataTransactionError:{}|{}|{}", ContextUtil.getTrace(), tx.getXid(), originalException.fillInStackTrace().getMessage());
//    }
//
//    @Override
//    public void onRollbackRetrying(GlobalTransaction tx, Throwable originalException) {
//        super.onRollbackRetrying(tx, originalException);
//        log.info("邮件告诉:分布式事物出现异常:[onRollbackRetrying],xid:[{}]", tx.getXid());
//        log.debug("SeataTransactionError:{}|{}|{}", ContextUtil.getTrace(), tx.getXid(), originalException.fillInStackTrace().getMessage());
//    }
//}
